unit unStockQRY;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, unQueryBase, cxGraphics, cxControls, cxLookAndFeels,
  cxLookAndFeelPainters, cxContainer, cxEdit, dxSkinsCore, dxSkinBlack,
  dxSkinBlue, dxSkinCaramel, dxSkinCoffee, dxSkinDarkRoom, dxSkinDarkSide,
  dxSkinFoggy, dxSkinGlassOceans, dxSkiniMaginary, dxSkinLilian,
  dxSkinLiquidSky, dxSkinLondonLiquidSky, dxSkinMcSkin, dxSkinMoneyTwins,
  dxSkinOffice2007Black, dxSkinOffice2007Blue, dxSkinOffice2007Green,
  dxSkinOffice2007Pink, dxSkinOffice2007Silver, dxSkinPumpkin, dxSkinSeven,
  dxSkinSharp, dxSkinSilver, dxSkinSpringTime, dxSkinStardust, dxSkinSummer2008,
  dxSkinsDefaultPainters, dxSkinValentine, dxSkinXmas2008Blue, DBGridEhGrouping,
  dxSkinsdxBarPainter, DB, ADODB, dxBar, cxClasses, GridsEh, DBGridEh,
  cxGroupBox, StdCtrls, CnAAFont, CnAACtrls, ActnList, RzButton, ExtCtrls,
  RzPanel;

type
  TfrmStockQRY = class(TQueryBase)
    CnAALabel1: TCnAALabel;
    Label1: TLabel;
    edtEnter: TEdit;
    procedure edtEnterKeyPress(Sender: TObject; var Key: Char);
    procedure FormCreate(Sender: TObject);
    procedure AExcuteQRYExecute(Sender: TObject);override;
  private
    { Private declarations }
  public
    { Public declarations }
    function QueryInit:boolean;override;
  end;


implementation

{$R *.dfm}

procedure TfrmStockQRY.AExcuteQRYExecute(Sender: TObject);
begin
  qryMaster.Close;
  qryMaster.Parameters.ParamByName('Key').Value:=edtEnter.Text;
  qryMaster.Open;
end;

procedure TfrmStockQRY.edtEnterKeyPress(Sender: TObject; var Key: Char);
begin
  if Key=#13 then
  begin
    AExcuteQRYExecute(Sender);
    edtEnter.SelectAll;
  end;
end;

procedure TfrmStockQRY.FormCreate(Sender: TObject);
begin
  inherited;
  MasterQueryID:='ID_STOCKQRY';
  DetailqueryID:='';
end;

function TfrmStockQRY.QueryInit: boolean;
begin
  inherited QueryInit;
  qryMaster.Close;
  qryMaster.SQL.Clear;
  qryMaster.SQL.Add('exec SearchGoodsStock :Key');
end;

end.
